package com.itheima.d1_ip;

import java.net.InetAddress;

public class InetAddressTest {
    public static void main(String[] args)throws Exception {
        InetAddress ip1 = InetAddress.getLocalHost();
        System.out.println(ip1.getHostAddress());
        System.out.println(ip1.getHostName());

        InetAddress ip2 = InetAddress.getByName("www.baidu.com");
        System.out.println(ip2.getHostAddress());
        System.out.println(ip2.getHostName());

        System.out.println(ip2.isReachable(6000));
    }
}
